package Chuong03;

import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class Bai04b extends JPanel{
	public void paintComponent(Graphics g){
		super.paintComponent(g);
		super.paintComponent(g);
		g.drawLine(0,  250, 600, 250);
		g.drawLine(250, 0, 250, 500);
		
		int[] x = new int[100];
		int[] y = new int[100];
		int k=0;
		for (int i = -25; i < 50; i++){
			x[k] = i*10 + 250;
			y[k] = (int) (Math.sin(i)*10 + 250);
			System.out.println(x[k] + ","+ y[k]);
			System.out.println(x[k] + ","+ y[k]);
			k++;
		}	
		g.setColor(Color.RED);
		g.drawPolyline(x,  y,  60);
		g.setColor(Color.BLUE);
		g.drawString("O", 250, 250);
		g.drawString("X+", 590, 250);
		g.drawString("Y+", 250, 500);
	}
	public static void main(String[] args) {
		JFrame f = new JFrame("Chuong03_04");
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		Bai04b panel = new Bai04b();
		f.add(panel);
		f.setSize(700, 700);
		f.setVisible(true);
	}

}
